/*********************************************************
          File Name:10.9.cpp
          Author: Abby Cin
          Mail: abbytsing@gmail.com
          Created Time: Tue 15 Sep 2015 02:48:02 PM CST
**********************************************************/

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using std::vector;
using std::sort;
using std::unique;
using std::string;
using std::cout;
using std::endl;

void show(vector<string> &v)
{
        for(const auto &x: v)
                cout << x << " ";
        cout << endl;
}

void elimDups(vector<string> &v)
{
        sort(v.begin(), v.end());

        show(v);

        auto unique_end = unique(v.begin(), v.end());

        show(v);

        v.erase(unique_end, v.end());

        show(v);
}

int main()
{
        vector<string> v{"this", "is", "is", "a", "test"};
        show(v);
        elimDups(v);
        return 0;
}
